<?php
/**
 * DynaGrid - The PHP datagrid
 *
 * @package    DynaGrid
 * @author     $Author: keesschepers $
 * @version    $Id: index.php 12 2011-02-12 00:33:20Z keesschepers $
 */

ini_set('display_errors',true);
error_reporting(E_ALL);

set_include_path(get_include_path() . ':'.realpath(dirname(__FILE__) . '/../'));

include_once 'Grid.php';
include_once 'DataSource/Adapter/Array.php';
DynaGrid_Grid::registerDataSourceAdapter(new DynaGrid_DataSource_Adapter_Array());

/**
 * In this example we are going to use a simple array as data container for drawing the
 * data of the grid.
 */
$data = array();
$data[] = array('field1' => '1', 'field2' => 'Another value','SomeField3' => 'kees');
$data[] = array('field1' => '2', 'field2' => 'Another slave value','SomeField3' => 'Jelle');
$data[] = array('field1' => '3', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '4', 'field2' => 'Another test value','SomeField3' => 'Jurgen');
$data[] = array('field1' => '5', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '6', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '7', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '8', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '9', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '10', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '11', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '12', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '13', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '14', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '15', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '16', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '17', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '18', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '19', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '20', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '21', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '22', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '23', 'field2' => 'Another value','SomeField3' => 'kees');
$data[] = array('field1' => '24', 'field2' => 'Another slave value','SomeField3' => 'Jelle');
$data[] = array('field1' => '25', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '26', 'field2' => 'Another test value','SomeField3' => 'Jurgen');
$data[] = array('field1' => '27', 'field2' => 'Another value','SomeField3' => 'kees');
$data[] = array('field1' => '28', 'field2' => 'Another slave value','SomeField3' => 'Jelle');
$data[] = array('field1' => '29', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '30', 'field2' => 'Another test value','SomeField3' => 'Jurgen');
$data[] = array('field1' => '31', 'field2' => 'Another value','SomeField3' => 'kees');
$data[] = array('field1' => '31', 'field2' => 'Another slave value','SomeField3' => 'Jelle');
$data[] = array('field1' => '32', 'field2' => 'Another master value','SomeField3' => 'Steven');
$data[] = array('field1' => '33', 'field2' => 'Another test value','SomeField3' => 'Jurgen');

$datagrid = new DynaGrid_Grid($data);
$datagrid->setCaption('Title of your table!');
$datagrid->splitResults(10);
?>
<html>
	<head>
		<title>DataGrid Example</title>
		<link href="./dynagrid.css" type="text/css" rel="stylesheet" media="screen" />
	</head>
	<body>
		<h1>DynaGrid Array Adapter example</h1>
		<?php echo $datagrid->getHTML(); ?>
                <h3>Source</h3>
                <?php show_source(__FILE__); ?>
	</body>
</html>
